CREATE OR REPLACE TRIGGER USTLV100.TRIG_AUD_SISTEMA
  BEFORE INSERT 
  ON USTLV100.Aud_Sistema
  FOR EACH ROW
  WHEN (new.CODAUDSIST is null)
DECLARE
  v_id USTLV100.Aud_Sistema.CODAUDSIST%TYPE;
BEGIN
  SELECT USTLV100.SEC_AUD_SISTEMA.nextval INTO v_id FROM DUAL;
  :new.CODAUDSIST := v_id;
END TRIG_AUD_SISTEMA;
/

CREATE OR REPLACE TRIGGER USTLV100.TRIG_AUDIO
  BEFORE INSERT 
  ON USTLV100.Audio
  FOR EACH ROW
  WHEN (new.CODAUDIO is null)
DECLARE
  v_id USTLV100.Audio.CODAUDIO%TYPE;
BEGIN
  SELECT USTLV100.SEC_AUDIO.nextval INTO v_id FROM DUAL;
  :new.CODAUDIO := v_id;
END TRIG_AUDIO;
/

CREATE OR REPLACE TRIGGER USTLV100.TRIG_EMPRESA
  BEFORE INSERT 
  ON USTLV100.Empresa
  FOR EACH ROW
  WHEN (new.CODEMPRESA is null)
DECLARE
  v_id USTLV100.Empresa.CODEMPRESA%TYPE;
BEGIN
  SELECT USTLV100.SEC_EMPRESA.nextval INTO v_id FROM DUAL;
  :new.CODEMPRESA := v_id;
END TRIG_EMPRESA;
/

CREATE OR REPLACE TRIGGER USTLV100.TRIG_USUARIO_EMPRESA
  BEFORE INSERT 
  ON USTLV100.Usuario_Empresa
  FOR EACH ROW
  WHEN (new.CODUSREMPRESA is null)
DECLARE
  v_id USTLV100.Usuario_Empresa.CODUSREMPRESA%TYPE;
BEGIN
  SELECT USTLV100.SEC_USUARIO_EMPRESA.nextval INTO v_id FROM DUAL;
  :new.CODUSREMPRESA := v_id;
END TRIG_USUARIO_EMPRESA;
/